#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>
int stringrotation(const char* arr1, const char* arr2)
{
	char tmp[256] = { 0 };
	strcpy(tmp, arr1);
	strcat(tmp, arr1);
	return strstr(tmp, arr2) != NULL;
}
int main()
{
	char arr1[100] = "AABCD";
	char arr2[50] = "";
	scanf("%s", arr2);
	int ret = stringrotation(arr1, arr2);
	if (ret == 1)
	{
		printf("YES\n");
	}
	else
		printf("NO\n");
	return 0;
}

